module motor(p, m, w);
	inout p,m,w;
	electrical p,m;				// Electrical Connections
	rotational_omega w;			// Motor Rotational Shaft

	parameter real r = 1.0e-3;	// Winding Resistance
	parameter real l = 10.0e-3;	// Winding inductance
	parameter real d = 0.0;		// Motor Friction Loss
	parameter real j = 10.0e-6;	// Motor Shaft Inertia
	parameter real ke = 1.0;	// Motor Electrical Constant
	parameter real kt = 1.0;	// Motor Torque Constant

    analog begin
    	// Electrical Equation
		V(p,m) <+ ke*Omega(w) + r*I(p,m) + l*ddt(I(p,m));
		// mechanical Equation
		Tau(w) <+ kt*I(p,m) - d*Omega(w) - j*ddt(Omega(w));
    end
endmodule
